package com.ds.infrastructure.hyperspace.console.entity.enums;

/**
 * @author: yaozhendong
 * @create: 2019-10-25 15:55
 **/

public interface TbNodeExecuteLogEnum {
    /**
     * TASK_TYPE类型:1(ONE);2(TWO)
     */
    enum TASK_TYPE {
        RELEASE_TASK(1, "网关配置发送任务"),
        DEPLOY_INSTALL_TASK(2, "部署-安装任务"),
        DEPLOY_ACTIVE_TASK(3, "部署-激活任务");

        public final Integer code;
        private final String desc;

        TASK_TYPE(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static TASK_TYPE toEnum(int value) {
            for (TASK_TYPE item : TASK_TYPE.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }

    /**
     * 状态
     */
    enum RELEASE_TASK_STEP {
        PUSH_DATA(1, "推送网关配置数据");

        public final Integer code;
        public final String desc;

        RELEASE_TASK_STEP(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static RELEASE_TASK_STEP toEnum(int value) {
            for (RELEASE_TASK_STEP item : RELEASE_TASK_STEP.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }

    enum EXECUTE_STATE {
        INIT(1, "初始化（未执行状态）"),
        SUCCESS(2, "成功"),
        FAIL(3, "失败");

        public final Integer code;
        private final String desc;

        EXECUTE_STATE(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static EXECUTE_STATE toEnum(int value) {
            for (EXECUTE_STATE item : EXECUTE_STATE.values()) {
                if (item.code == value) {
                    return item;
                }
            }
            return null;
        }
    }
}
